﻿using SrBBSPro.BaseClasses;
using SrBBSPro.Services;
using NPoco;
using System;
using SrBBSPro.Util;

namespace SrBBSPro.Entities
{
    /// <summary>
    /// 用户实体
    /// </summary>
    [TableName("Users")]
    [PrimaryKey("Id", AutoIncrement = false)]
    public class User : BaseEntity<string>
    {
        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }
        /// <summary>
        /// 姓名
        /// </summary>
        public string StaffName { get; set; }
        /// <summary>
        /// 职务
        /// </summary>
        public string Position { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        public string Gender { get; set; }
        /// <summary>
        /// 部门
        /// </summary>
        public string Depart { get; set; }
        /// <summary>
        /// 个性签名
        /// </summary>
        public string Sign { get; set; }
        /// <summary>
        /// 头像
        /// </summary>
        public string HeadPortrait { get; set; }
        /// <summary>
        /// 积分
        /// </summary>
        public int Integral { get; set; }
        /// <summary>
        /// 是否VIP
        /// </summary>
        public bool IsVip { get; set; }
        /// <summary>
        /// VIP等级
        /// </summary>
        public int VipLevel { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 是否已禁用
        /// </summary>
        public bool IsDisabled { get; set; }
        /// <summary>
        /// 是否管理员
        /// </summary>
        public bool IsAdmin { get; set; }
      
        /// <summary>
        /// 该用户发表的帖子总数
        /// </summary>
        [Ignore]
        public int PostCount
        {
            get
            {
                return new PostService().GetPostCountByUserId(Id);
            }
        }

        [Ignore]
        public string DepartName
        {
            get
            {
                return DataHelper.DepartName[Depart];
            }
        }
    }
}
